apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend-server
  namespace: {{ .Values.namespace }}
spec:
  replicas: 2
  selector:
    matchLabels:
      app: frontend-server
  template:
    metadata:
      labels:
        app: frontend-server
    spec:
      containers:
        - name: frontend-server
          image: server
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8000
          volumeMounts:
            - name: chroma
              mountPath: /test
          env:
            - name: IS_PERSISTENT
              value: "TRUE"
            - name: CHROMA_PRODUCER_IMPL
              value: "chromadb.logservice.logservice.LogService"
            - name: CHROMA_CONSUMER_IMPL
              value: "chromadb.logservice.logservice.LogService"
            - name: CHROMA_SEGMENT_MANAGER_IMPL
              value: "chromadb.segment.impl.manager.distributed.DistributedSegmentManager"
            - name: PULSAR_BROKER_URL
              value: "pulsar.chroma"
            - name: PULSAR_BROKER_PORT
              value: "6650"
            - name: PULSAR_ADMIN_PORT
              value: "8080"
            - name: ALLOW_RESET
              value: "TRUE"
            - name: CHROMA_SYSDB_IMPL
              value: "chromadb.db.impl.grpc.client.GrpcSysDB"
            - name: CHROMA_SERVER_GRPC_PORT
              value: "50051"
            - name: CHROMA_COORDINATOR_HOST
              value: "coordinator.chroma"
            - name: CHROMA_MEMBERLIST_PROVIDER_IMPL
              value: "chromadb.segment.impl.distributed.segment_directory.MockMemberlistProvider"
            - name: CHROMA_LOGSERVICE_HOST
              value: "logservice.chroma"
            - name: CHROMA_LOGSERVICE_PORT
              value: "50051"
      volumes:
        - name: chroma
          emptyDir: {}

---
apiVersion: v1
kind: Service
metadata:
  name: frontend-server
  namespace: {{ .Values.namespace }}
spec:
  ports:
    - name: server-port
      port: 8000
      targetPort: 8000
  selector:
    app: frontend-server
  type: ClusterIP
